<template>
  <div>
      <div class="alert alert-danger" v-show="!ishow">
        账号或密码错误
      </div>
      <div>
          <input class="form-control form-control-lg" type="text" placeholder="输入账号" v-model="acc">
          <input class="form-control form-control-lg" type="text" placeholder="输入密码" v-model="pwd">
      </div>
      <div>
          <button type="button" class="btn btn-outline-success" @click="handle">登录</button>
      </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import {useRouter, useRoute} from 'vue-router';

// 获取路由对象
const router = useRouter();

const acc = ref(null)

const pwd = ref(null)

const ishow = ref(true)

const handle = e => {
  if(acc.value == 'admin' && pwd.value == 'admin' ){
      router.replace('/home');
  }else {
      acc.value = ''
      pwd.value = ''
      ishow.value = false
  }
}


</script>

<style scoped>

</style>